#include "StaticAnimation.h"
#include <sstream>

float StaticAnimation::frame_speed=0.01;
//-------------------------------------------------------------
StaticAnimation::StaticAnimation(string name, int num_frame){
    StaticAnimation::name = name;
    StaticAnimation::num_frame = num_frame;
    cur_frame=0;
}
//-------------------------------------------------------------
void StaticAnimation::setPosition(float x, float y){
    StaticAnimation::x = x;
    StaticAnimation::y = y;
}
//-------------------------------------------------------------
void StaticAnimation::animate(float time){
    cur_frame += frame_speed*time;
    if(cur_frame > num_frame)
        cur_frame = 0;
}
//-------------------------------------------------------------
string StaticAnimation::getFramePath(){
    std::ostringstream ss;
    ss << (int)cur_frame;
    return name + ss.str() + ".png";
}
//-------------------------------------------------------------
float StaticAnimation::getX(){
    return x;
}
//-------------------------------------------------------------
float StaticAnimation::getY(){
    return y;
}
//-------------------------------------------------------------
void StaticAnimation::setName(string name){
    StaticAnimation::name = name;
}
